package org.iweb.web.ui;

import java.util.UUID;

import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.iweb.html.api.AbstractHtmlElement;
import org.iweb.html.api.Listener;
import org.iweb.html.impl.basic.Button;
import org.iweb.html.impl.basic.Form.CustomFormBean;
import org.iweb.html.impl.layout.VerticalLayout;
import org.iweb.init.servlet.IWebApp;
import org.iweb.init.servlet.IWebApplication;

//@WebServlet(urlPatterns="/*")
@IWebApp("/")
public class MyApp extends IWebApplication {

	/**
	 *
	 */
	private static final long serialVersionUID = -5567335213704444998L;

	@Override
	public AbstractHtmlElement render(HttpServletRequest arg0, HttpServletResponse arg1) {

		Button b=new Button("ciupi");


		VerticalLayout vl=new VerticalLayout();

		b.onClick(new Listener() {

			/**
			 *
			 */
			private static final long serialVersionUID = 5032079028504813838L;

			@Override
			public void run(HttpServletRequest request, CustomFormBean formBean) {

				getJsEngine().text(b, UUID.randomUUID().toString());

			}
		});

		vl.append(b);

		return vl;

	}

}
